package cn.tedu.csmall.product.controller;

import cn.tedu.csmall.product.pojo.dto.SupDetailAndNewDTO;
import cn.tedu.csmall.product.service.ISupDetailServuce;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@Api(tags = "10.SPU详情管理模块")
@RestController
@Slf4j
@RequestMapping("/supDetail")
public class SupDetailController {
    @Autowired
    ISupDetailServuce servuce;
    public SupDetailController() {
        log.info("创建配置类:SupDetailController");
    }


    @ApiOperation("添加SPU详情")
    @PostMapping("/and")
    public String and(SupDetailAndNewDTO supDetailAndNewDTO){
        log.debug("请求参数：{}",supDetailAndNewDTO);
        servuce.andNew(supDetailAndNewDTO);
        return "添加完成！";
    }

    @ApiOperation("根据id删除SPU详情")
    @PostMapping("/{id:[0-9]+}/delete")
    public String delete(@PathVariable Long id){
        log.debug("请求参数：{}",id);
        servuce.delete(id);
        return "删除完成！";
    }
}
